<%@ page language="java" contentType="text/html; charset=UTF-8"
	import="java.util.*" pageEncoding="UTF-8"%>
	<%String path=request.getContextPath(); %>
<!DOCTYPE html>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BONC简历操作中心</title>
<jsp:include page="import.jsp"/>

 <link href="<%=path%>/css/basicPage/select.css" rel="stylesheet" />

</head>

<body style="background-color: #F4F5F8;">

	<jsp:include page="head.jsp"></jsp:include>

		<div class="container">

			<div class="row">

				<div class="col-md-12" style="background-color: #fff;">

					<div id="total_div">

						<div id="Dashboard_div" class="glyphicon glyphicon-list" style="color:#66CCFF;"><span style="color:#66CCFF;">简历搜索</span>
						<div id="label_top" style="float:right;height: 48px;">
						<span class="glyphicon glyphicon-edit" style="float:right;color:#99CC33;"></span>
						<div id="div_down" class="input-group " style="font-size: 18px; font-family: '微软雅黑';width:400px;color:#99CC33;">
							<form action="<%=path%>/select/detailQuery?queryType=${requestScope.queryType}&&queryValue=${requestScope.queryValue}&&pageNo=${requestScope.pageDataMap.pageIndex}"
										method="post" >
									<div style="margin-top:0px;">	
								<label style="margin-left: 0px;color:#333333;">选择显示条件</label> 
								<select id="show_select" name="show_select" class="selectpicker" multiple
									data-live-search="true" data-live-search-placeholder="Search"
									data-actions-box="true">
									<!-- <optgroup label="filter1"> -->
										<option id="xueli" >学历</option>
										<option id="xingbie" >性别</option>
										<option id="xuexiao" >学校</option>
										<option id="gongsi" >公司</option>
										<option id="qiuzhi" >求职意向</option>
 										<option id=" ">年龄</option>
										<option id=" ">电话</option>
										<option id=" ">Email</option>
										<option id=" ">工作经历</option>
										<option id=" ">教育经历</option>
										<option id=" ">工作经验</option>				 
 				 
									<!-- </optgroup> -->
								</select>
<!-- onclick="click1();" -->
								<button class="btn btn-default glyphicon glyphicon-share-alt" style="color:#99CC33;"
									 type="submit"></button>
									 </div>
								</form>
							
								</div>
							
							</div>
							
						</div>

						<div id="select_div">
							<!-- <div id="select_top">
								<p>&nbsp;简历搜索</p>
							</div> -->

							<div id="resume_select_div">
 		
 							<div class="input-group">
								<!-- 点击 按钮 之后 直接 刷新 一次页面得了 -->
								
									<!-- 在这 添加一个 下拉列表框 ， 选择 需要显示的列    姓名 是 必须显示的 -->

									<form action="<%=path%>/select/detailQuery"
										method="post" style="margin-top:-5px;margin-left:200px;padding-bottom:20px;">

										<%
											String str = (String) request.getAttribute("queryValue");
										%>

										<input type="text" name="queryValue" class="form-control"
											style="width: 350px;"
											placeholder="输入条件以检索" value="<%=str%>" /> <span class="">
											<button class="btn btn-default" type="submit">Go!</button>
										</span>
									</form>
								</div>
							</div>

							<div style="padding-top: 10px">
								<!-- 列表框框  显示   热门 简历 最近简历等 。。   start-->

								<div style="width: 100%; background-color: #fff;">
									<div id="wizard">

									 
										<div style="background-color: #fff;">
											<table id="BookTable"
												class="table table-striped table-bordered table-hover">
											
												<%
												String show_selectstr =(String)request.getAttribute("show_select"); 
												
												if(show_selectstr==null||show_selectstr.equals("null")){
												
												// System.out.println("in if show_selectstr==null");
													%>
						 		<thead>
									<tr class="tableHead">

							<!-- 12个 -->
										<th width="10%">姓名</th>
										<th class="age_div" width="10%">年龄</th>
										<th class="education_div" width="10%">学校</th>
										<th class="phoneNum_div" width="10%">电话</th>
										<th class="email_div" width="10%">Email</th>
										<th class="gender_div error" width="10%">性别</th>
										<th class="company_div error" width="20%">公司</th>
										<th class="degree_div error" width="10%">学历</th>
										<th class="careerObjective_div error" width="20%">求职意向</th>
										<th class="educationalExperience_div error" width="20%">教育经历</th>
										<th class="workExperience_div error" width="20%">工作经历</th>
										<th class="workingExperience_div error" width="10%">工作经验</th>
										
										<th width="10%">查看</th>
									</tr>
								</thead>

								<tbody>
								<%}else{
									
									 String[] ss = new String[20];
									 
							         ss = show_selectstr.split(",");
									
							         // 让thead 中的数据 对应 显示
							         %>
				<thead>
					<tr class="tableHead">
					<!-- 12个 -->
						 <th width="10%">姓名</th>
		
							         <% 
							         //用来显示 对用的 thead th
							         for (int i = 0; i < ss.length; i++){
							        	 
							        	 if(ss[i].equals("年龄")){ // 就是 那一列显示
								        		%>
								        		 <th class="age_div" width="10%">年龄</th>
								        		<% 
								        		 
								        		}
								        		if(ss[i].equals("学校")){  
								        			%>
								        			<th class="education_div" width="10%">学校</th>
	 
									        		<% 
								        		}
								        		if(ss[i].equals("电话")){  
								        			%>
									        		<th class="phoneNum_div" width="10%">电话</th>
									        		<% 
								        		}
								        		if(ss[i].equals("Email")){  
								        			%>
									        		<th class="email_div" width="10%">Email</th>
									        		<% 
								        		}
								        		if(ss[i].equals("性别")){  
								        			%>
									        		<th class="gender_div" width="10%">性别</th>
									        		<% 
								        		}
								        		if(ss[i].equals("公司")){ 
								        			%>
									        		<th class="company_div" width="20%">公司</th>
									        		<% 
								        		}
								        		if(ss[i].equals("学历")){  
								        			%>
									        		<th class="degree_div" width="10%">学历</th>
									        		<% 
								        		}
								        		if(ss[i].equals("求职意向")){  
								        			%>
									        		<th class="careerObjective_div" width="20%">求职意向</th>
									        		<% 
								        		}
								        		if(ss[i].equals("教育经历")){  
								        			%>
									        		<th class="educationalExperience_div" width="20%">教育经历</th>
									        		<% 
								        		}
								        		if(ss[i].equals("工作经历")){ 
								        			%>
									        		<th class="workExperience_div" width="20%">工作经历</th>
						
									        		<% 
								        		}
								        		if(ss[i].equals("工作经验")){  
								        			%>
								        			<th class="workingExperience_div" width="10%">工作经验</th> 
								        		<% 
								        		} 
							         }
							         
							    
							    // 让tbody中的对应数据显示
							    %>
						 <th width="10%">查看</th>
					</tr>
				</thead>

				<tbody>
								<% }%>
									<input type="hidden"  id="show_selectstr" name="show_selectstr" value="<%=show_selectstr%>">
													<%
														List<Map<String, Object>> list = (List<Map<String, Object>>) request
																.getAttribute("resultList");
													
														
												 
														if (list != null) {

															Iterator<Map<String, Object>> it = list.iterator();
															while (it.hasNext()) {
																Map map = it.next();
																// 把 这三部分 中的 换行符替换掉，因为会撑大原来的布局
																String educationalExperience = (String) map
																		.get("educationalExperience");
																educationalExperience = educationalExperience.replaceAll(
																		"<br>", ";");
																String workExperience = (String) map.get("workExperience");
																workExperience = workExperience.replaceAll("<br>", ";");
																
																String careerObjective = (String) map.get("careerObjective");
																careerObjective = careerObjective.replaceAll("<br>", ";");
															//	System.out.print("show_selectstr = = "+show_selectstr);
																if(show_selectstr==null||show_selectstr.equals("null")){
																	//System.out.print("in if  null");
																	%>
										 		 
																	
													<tr>
														<td title="<%=map.get("name")%>"><%=map.get("name")%></td>
														<td class="age_div" title="<%=map.get("age")%>"><%=map.get("age")%></td>
														<td class="education_div" title="<%=map.get("education")%>"><%=map.get("education")%></td>
														<td class="phoneNum_div" title="<%=map.get("phoneNum")%>"><%=map.get("phoneNum")%></td>
														<td class="email_div" title="<%=map.get("email")%>"><%=map.get("email")%></td>
 
 
														<td class="gender_div error" title="<%=map.get("gender")%>"><%=map.get("gender")%></td>
														<td class="company_div error" title="<%=map.get("company")%>"><%=map.get("company")%></td>
														<td class="degree_div error" title="<%=map.get("degree")%>"><%=map.get("degree")%></td>
														<td class="careerObjective_div error" title="<%=map.get("careerObjective")%>"><%=careerObjective%></td>
														<td class="educationalExperience_div error" title="<%=map.get("educationalExperience")%>"><%=educationalExperience%></td>
														<td class="workExperience_div error" title="<%=map.get("workExperience")%>"><%=workExperience%></td>
														<td class="workingExperience_div error" title="<%=map.get("workingExperience")%>"><%=map.get("workingExperience")%>年</td>

														<td><a
															href="<%=path%>/personalResume?id=<%=map.get("id")%>">查看</a></td>
													</tr>
																	
																	
																	
																	<%
																	
																	
																	// show_selectstr 有值
																}else{
																
																	 String[] ss = new String[20];
 
															         ss = show_selectstr.split(",");
															  %> 
															  
													<tr>
														<td title="<%=map.get("name")%>"><%=map.get("name")%></td>
																<% 
															         for (int i = 0; i < ss.length; i++){
															        	   //System.out.println(i+"个 值 为 = "+ss[i]);
															        	 // 在这 就需要 判断 ss[i] 对应的是哪一个，如果不对应 则隐藏
															        	 
															        	 if(ss[i].equals("年龄")){ // 就是 那一列显示
															        		%>
															        		<td class="age_div" title="<%=map.get("age")%>"><%=map.get("age")%></td>
															        		<% 
															        		 
															        		}
															        		if(ss[i].equals("学校")){  
															        			%>
															        			<td class="education_div" title="<%=map.get("education")%>"><%=map.get("education")%></td>
								 
																        		<% 
															        		}
															        		if(ss[i].equals("电话")){  
															        			%>
																        		<td class="phoneNum_div" title="<%=map.get("phoneNum")%>"><%=map.get("phoneNum")%></td>
																        		<% 
															        		}
															        		if(ss[i].equals("Email")){  
															        			%>
																        		<td class="email_div" title="<%=map.get("email")%>"><%=map.get("email")%></td>
																        		<% 
															        		}
															        		if(ss[i].equals("性别")){  
															        			%>
																        		<td class="gender_div" title="<%=map.get("gender")%>"><%=map.get("gender")%></td>
																        		<% 
															        		}
															        		if(ss[i].equals("公司")){ 
															        			%>
																        		<td class="company_div" title="<%=map.get("company")%>"><%=map.get("company")%></td>
																        		<% 
															        		}
															        		if(ss[i].equals("学历")){  
															        			%>
																        		<td class="degree_div" title="<%=map.get("degree")%>"><%=map.get("degree")%></td>
														
																        		<% 
															        		}
															        		if(ss[i].equals("求职意向")){  
															        			%>
																        		<td class="careerObjective_div" title="<%=map.get("careerObjective")%>"><%=careerObjective%></td>
																        		<% 
															        		}
															        		if(ss[i].equals("教育经历")){  
															        			%>
																        		<td class="educationalExperience_div" title="<%=map.get("educationalExperience")%>"><%=educationalExperience%></td>
																        		<% 
															        		}
															        		if(ss[i].equals("工作经历")){ 
															        			%>
																        		<td class="workExperience_div" title="<%=map.get("workExperience")%>"><%=workExperience%></td>
																        		<% 
															        		}
															        		if(ss[i].equals("工作经验")){  
															        			%>
															        			<td class="workingExperience_div" title="<%=map.get("workingExperience")%>"><%=map.get("workingExperience")%>年</td>
															        		<% 
															        		}
															        	 
															        	// for 
															         }
															         %> 
															         <td><a
																		href="<%=path%>/personalResume?id=<%=map.get("id")%>">查看</a></td>
																</tr>   
															         
																<% 	
																}
																
															     
													%>

													<!-- 原来 tr td 位置 -->
													<%
														}
														}
													%>
												</tbody>

											</table>

											<div class="pageTurn">
												<input type="hidden"  id="deleteStr" name="deleteStr" value="1" runat="server">
												<a id="first" class="btn btn-default btn-sm"
													href="<%=path%>/select/detailQuery?queryType=${requestScope.queryType}&&queryValue=${requestScope.queryValue}&&pageNo=0&&show_select=<%=show_selectstr %>">首页</a>
												<a id="previous" class="btn btn-default btn-sm"
													href="<%=path%>/select/detailQuery?queryType=${requestScope.queryType}&&queryValue=${requestScope.queryValue}&&pageNo=${requestScope.pageDataMap.pageIndex-1
												<=0?0:requestScope.pageDataMap.pageIndex-1}&&show_select=<%=show_selectstr %> ">
													上一页</a> <a id="next " class="btn btn-default btn-sm " onclick="nextPage();"
													href="<%=path%>/select/detailQuery?queryType=${requestScope.queryType}&&queryValue=${requestScope.queryValue}&&pageNo=${requestScope.pageDataMap.pageIndex+1>=requestScope.pageDataMap.totalPage?requestScope.pageDataMap.totalPage-1:requestScope.pageDataMap.pageIndex+1}&&show_select=<%=show_selectstr %>">
													下一页</a><a id="last" class="btn btn-default btn-sm"
													href="<%=path%>/select/detailQuery?queryType=${requestScope.queryType}&&queryValue=${requestScope.queryValue}&&pageNo=${requestScope.pageDataMap.totalPage-1}&&show_select=<%=show_selectstr %>">尾页</a>
												<span class="mySpan"> <span>当前第${requestScope.pageDataMap.pageIndex+1}页</span>
													<span>共${requestScope.pageDataMap.totalCount}条记录 </span> <span>共${requestScope.pageDataMap.totalPage}页</span>
													<span>每页10条</span> <!-- 												<span>跳到第 </span>  -->
											</div>
											<!-- 页码变化 end-->
										</div>
									</div>



									<!--end-->
								</div>

								<!--end-->
							</div>

						</div>

						<!-- end -->
					</div>

				</div>
			</div>

		</div>
	
	
	<script type="text/javascript">

// 如果 show_select = null 就按照原来的情况 显示，否则 就按照 show_select中 的值显示
$(window).load(function(){
    
		//最上面的 鼠标悬浮效果
				 
			  $("#label_top").hover(function() {
					$("#div_down").show();
				},function() {
					$("#div_down").hide();
				});  
			  $("#show_select").hover(function() {
					$("#div_down").show();
				},function() {
					$("#div_down").hide();
				});

//$(document).ready(function(){
	var show_selectstr = $("#show_selectstr").val();
//alert("要显示的列"+show_selectstr);
// 因为 是刷新 新的页面，所以得让 列表框 显示上次的数据
 
//$(".filter-option.pull-left").val(show_selectstr);
if(show_selectstr=="null"){
	$("#niu_show_Span").html(" ");
}else{
	$("#niu_show_Span").html(show_selectstr);
}

$("#niu_show_btn").attr("title",show_selectstr);

 var str = "" + show_selectstr + "";
 //alert(str);

	var strs = new Array(); //定义一数组 
	strs = str.split(","); //字符分割 
	var emp = ['年龄','学校','电话','Email','性别','公司','学历','求职意向','教育经历','工作经验','工作经历'];
	 
	// alert("一开始的 emp："+emp);
	for ( var i = 0; i < strs.length; i++) {
		//分割后的字符输出 
		//alert(strs[i]);

		// 判断 strs[i] 是哪一个option 让相应的 li显示   当然 其他的得隐藏
if(strs.length>0){
	
	if(strs[i]=="年龄"){ // 就是 那一列显示
		//$(".age_div").fadeIn();
		//$("#liId5").addClass("selected"); 
		$("#liId5 a").attr("aria-selected","true");
	 	//$("[data-original-index='5']").addClass("selected"); 
		//$("niuDiv ul li:eq(1)").addClass("selected"); 
		emp.remove('年龄');
	}
	if(strs[i]=="学校"){  
		//$(".education_div").fadeIn();
		//$("#liId2").addClass("selected");
		$("#liId2 a").attr("aria-selected","true");
		emp.remove('学校');
	}
	if(strs[i]=="电话"){  
		//$(".phoneNum_div").fadeIn();
		//$("#liId6").addClass("selected"); 
		$("#liId6 a").attr("aria-selected","true");
		emp.remove('电话');
	}
	if(strs[i]=="Email"){  
		//$(".email_div").fadeIn();	
		//$("#liId7").addClass("selected");
		$("#liId7 a").attr("aria-selected","true");
		emp.remove('Email');
	}
	if(strs[i]=="性别"){  
		//$(".gender_div").fadeIn();	
		//$("#liId1").addClass("selected");
		$("#liId1 a").attr("aria-selected","true");
		emp.remove('性别');
	}
	if(strs[i]=="公司"){ 
		//$(".company_div").fadeIn();	
		//$("#liId3").addClass("selected"); 
		$("#liId3 a").attr("aria-selected","true");
		emp.remove('公司');
	}
	if(strs[i]=="学历"){  
		//$(".degree_div").fadeIn();
		//$("#liId0").addClass("selected");
		$("#liId0 a").attr("aria-selected","true");
		emp.remove('学历');
	}
	if(strs[i]=="求职意向"){  
		//$(".careerObjective_div").fadeIn();	
		//$("#liId4").addClass("selected"); 
		$("#liId4 a").attr("aria-selected","true");
		emp.remove('求职意向');
	}
	if(strs[i]=="教育经历"){  
		//$(".educationalExperience_div").fadeIn();	
		//$("#liId9").addClass("selected"); 
		$("#liId9 a").attr("aria-selected","true");
		emp.remove('教育经历');
	}
	if(strs[i]=="工作经历"){ 
		//$(".workExperience_div").fadeIn();	
		//$("#liId8").addClass("selected"); 
		$("#liId8 a").attr("aria-selected","true");
		emp.remove('工作经历');
	}
	if(strs[i]=="工作经验"){  
		//$(".workingExperience_div").fadeIn();
		//$("#liId10").addClass("selected"); 
		$("#liId10 a").attr("aria-selected","true");
		emp.remove('工作经验');
	}
	
	// if
}
		
		//for
	}
	//alert(emp);
	//alert("显示 循环 后的 emp："+emp);
	//  循环 emp  ，隐藏 对应的 列
	 
	
 

// 最后 括号
}); 

/*为了删除 数组  ，，设置的 两个方法*/
		Array.prototype.indexOf = function(val) {
			for (var i = 0; i < this.length; i++) {
			if (this[i] == val) return i;
			}
			return -1;
			};


		Array.prototype.remove = function(val) {
		var index = this.indexOf(val);
		if (index > -1) {
		this.splice(index, 1);
		}
		};

	 function turnStr(){
		var degree = $("#show_select").val();

		//alert(degree);
		var str = "" + degree + "";
		
		return str;
		
	}

	 
 
	 
</script>
</body>

</html>